/*
 *Copyright (c) 2024 Black Sesame Technologies
 *
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *Unless required by applicable law or agreed to in writing, software
 *distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *See the License for the specific language governing permissions and
 *limitations under the License.
*/
#ifndef _GIC_BASIC_H
#define _GIC_BASIC_H


void cpu_gicd_enable_grp0();
void cpu_gicd_enable_grp1();
void cpu_gicd_set_group(unsigned int intr_id, unsigned int group);
void cpu_gicd_set_enable(unsigned int intr_id);
void cpu_gicd_clear_enable(unsigned int intr_id);
void cpu_gicd_set_control(unsigned int intr_id, unsigned int control);
void cpu_gicd_set_targets(unsigned int intr_id, unsigned int targets);
void cpu_gicc_enable_grp0();
void cpu_gicc_enable_grp1();
void cpu_gicc_set_eoimodens();
void cpu_gicc_set_priority_mask(unsigned int priority);
unsigned int cpu_gicc_get_iar();
void cpu_gicc_set_eoir(unsigned int eoi);
unsigned int cpu_gicc_get_aiar();
void cpu_gicc_set_aeoir(unsigned int eoi);
void cpu_gich_en();
void cpu_gich_set_lr(unsigned int lr_id, unsigned int data);
void cpu_gicv_enable_grp0();
void cpu_gicv_enable_grp1();
void cpu_gicv_set_eoimodens();
void cpu_gicv_set_priority_mask(unsigned int priority);
unsigned int cpu_gicv_get_iar();
void cpu_gicv_set_eoir(unsigned int eoi);
unsigned int cpu_gicv_get_aiar();
void cpu_gicv_set_aeoir(unsigned int eoi);
void cpu_gicd_set_disable(unsigned int intr_id);
void cpu_gicd_send_sgi( int core_id, unsigned int intr_id);

//********new api for R5 Safety**************//
#define CPU0_IDX 1
#define CPU1_IDX 2

void cpu_gicd_set_priority(unsigned int intr_id, unsigned int priority);
void cpu_gic_config_nonsecure(void);
void cpu_gic_config_fiq(unsigned int intr_id,unsigned int edgeCfg,unsigned int cpuIdx);
void cpu_gic_config_irq(unsigned int intr_id,unsigned int edgeCfg,unsigned int cpuIdx);
#endif

